import {Component, ViewChild, Input, Output, EventEmitter} from "@angular/core";
import {ConfirmInfo} from "../models/confirmInfo";
/**
 * Created by Administrator on 2017/3/9.
 */
declare var $: any;

@Component({
    moduleId: module.id,
    selector: 'confirm-component',
    templateUrl: "../html/confirm.html",
})


export class ConfirmComponent {
    @ViewChild('confirm') confirm:any;
    @Output() getResult = new EventEmitter<boolean>();
    confirmInfo: ConfirmInfo = new ConfirmInfo("", "");

    ngOnInit() {
    }

    submit(result: boolean) {
        this.getResult.emit(result);
    }

    show(confirmInfo: ConfirmInfo) {
        this.confirmInfo = confirmInfo;
        $(this.confirm.nativeElement).modal("show")
    }


}

//使用
// <confirm-component #confrim1  (getResult)="getResult1($event)"></confirm-component>
// <button (click)="test()">kk</button>
//
// test(){
//     this.confrim1.show(new ConfirmInfo("删除","你确定删除这条信息？"));
// }
//
// getResult1(result:boolean){
//     console.log(result)
// }
